﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace Classes
{
    [DataContract]
    public class Flight
    {

        City from;
        City to;
        
        int id;
        int priceOfTheOneSeat;
        bool used;       
        DateTime departureTime;
        DateTime arrivalTime;
        string fromName;       
        string toName;
        string company;
        private int noOfSeats;


        public Flight(City from, City to) // shouldn't we add rest of the fields into constructor or make new one withh all of them ?
        {
            this.from = from;
            this.to = to;
            Used = false;

        }

        [DataMember]
        public string ToName
        {
            get { return toName; }
            set { toName = value; }
        }

        [DataMember]
        public string FromName
        {
            get { return fromName; }
            set { fromName = value; }
        }


        [DataMember]
        public int NoOfSeats
        {
            get { return noOfSeats; }
            set { noOfSeats = value; }
        }

        [DataMember]
        public string Company
        {
            get { return company; }
            set { company = value; }
        }

        [DataMember]
        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public City From
        {
            get
            {
                return from;
            }
        }

        public City To
        {
            get
            {
                return to;
            }
        }

       
        
        [DataMember]
        public int PriceOfTheOneSeat
        {
            get { return priceOfTheOneSeat; }
            set { priceOfTheOneSeat = value; }
        }
        [DataMember]
        public DateTime DepartureTime
        {
            get { return departureTime; }
            set { departureTime = value; }
        }
        [DataMember]
        public DateTime ArrivalTime
        {
            get { return arrivalTime; }
            set { arrivalTime = value; }
        }

        public TimeSpan getDuration
        {
            get { return arrivalTime - departureTime; }
        }

        public bool Used
        {
            get { return used; }
            set { used = value; }
        }
    }
}
